#ifndef FLOATING_H
#define FLOATING_H

#include <QWidget>
#include <QTimer>
#include <QPropertyAnimation>
#include <QMouseEvent>
#include <QDebug>
#include <QStyle>

namespace Ui {
class Floating;
}

class Floating : public QWidget
{
    Q_OBJECT


public:
    void setPosX(int posX);

    void setPoxY(int posY);

    void adjustParent(int parentWidth);

    static Floating& getInstance(QWidget* parent)
    {
        static Floating instance(parent);
        return instance;
    }

private:

    explicit Floating(QWidget *parent = nullptr);
    ~Floating();
    Floating(const Floating&);
    Floating& operator=(const Floating&);


private slots:
    void expandMenu();
    void flodMenu();

private:
    bool eventFilter(QObject * target, QEvent * event);

    void setTitleIcon();

private:
    Ui::Floating *ui;
    QTimer * m_expandTimer;
    QTimer * m_flodTimer;

    int m_posX;
    int m_posY;

    bool m_isExpand;
    bool m_bDragFlag;
    QPoint m_pointDrag;

    QPropertyAnimation * m_Animation;
};

#endif // FLOATING_H
